<script type="text/javascript">
	window.addEvent('domready', function() {
		$('save').addEvent('click', function(){
			$('form_action').set('value', 'save');
			
			return true;
		});
		
		$('saveNclose').addEvent('click', function(){
			$('form_action').set('value', 'saveNclose');
			
			return true;
		});
		
		$('saveNcreate').addEvent('click', function(){
			$('form_action').set('value', 'saveNcreate');
			
			return true;
		});
	});
</script>
<div id="tl_buttons">
<a onclick="Backend.getScrollOffset();" accesskey="b" title="Go back" class="header_back" href="typolight/main.php?do=catalog_attribute">Go back</a>
</div>
<h2 class="sub_headline"><?php if ($this->action == 'edit'): ?>Edit record ID <?php echo $this->attr_id; ?><?php else: ?>Create a record<?php endif; ?></h2>
<form enctype="application/x-www-form-urlencoded" method="post" class="tl_form" id="tl_catalog_attribute" action="typolight/main.php?do=catalog_attribute&amp;act=<?php if ($this->action == 'edit'): ?>edit&amp;id=<?php echo $this->attr_id; ?><?php else: ?>create<?php endif; ?>">
<div class="tl_formbody_edit">
<input type="hidden" value="tl_catalog_attribute" name="FORM_SUBMIT">
<input type="hidden" value="{attribute_detail},id_catalog,id_color,id_size;{attribute_info},catalog_stock" name="FORM_FIELDS[]">
<input type="hidden" value="save" name="FORM_ACTION" id="form_action" />

<fieldset class="tl_tbox block" id="pal_attribute_detail">
<legend onclick="AjaxRequest.toggleFieldset(this, 'attribute_detail', 'tl_catalog_attribute')">Product attribute detail</legend>
<div class="w50">
  <h3><label for="ctrl_id_catalog">Product Catallog</label></h3>
  <?php if ($this->catalogs): ?>
  <select onfocus="Backend.getScrollOffset();" class="tl_select" id="ctrl_id_catalog" name="id_catalog">
  <?php foreach ($this->catalogs as $key=>$strCatalog): ?>
	<option value="<?php echo $key; ?>"<?php if ($key == $this->current['id_catalog']): ?> selected="selected"<?php endif; ?>><?php echo $strCatalog; ?></option>
  <?php endforeach; ?>
  </select>
  <?php endif; ?>
  <p class="tl_help tl_tip">Please select attribute's product.</p>
</div>
<div class="w50">
  <h3><label for="ctrl_id_color">Product Color</label></h3>
  <?php if ($this->colors): ?>
  <select onfocus="Backend.getScrollOffset();" class="tl_select" id="ctrl_id_color" name="id_color">
  <?php foreach ($this->colors as $key=>$strColors): ?>
	<option value="<?php echo $key; ?>"<?php if ($key == $this->current['id_color']): ?> selected="selected"<?php endif; ?>><?php echo $strColors; ?></option>
  <?php endforeach; ?>
  </select>
  <?php endif; ?>
  <p class="tl_help tl_tip">Please select product's color.</p>
</div>
<div class="w50">
  <h3><label for="ctrl_id_size">Product Size</label></h3>
	<?php if ($this->sizes): ?>
	<select onfocus="Backend.getScrollOffset();" class="tl_select" id="ctrl_id_size" name="id_size">
		<?php foreach ($this->sizes as $key=>$strSize): ?>
		<option value="<?php echo $key; ?>"<?php if ($key == $this->current['id_size']): ?> selected="selected"<?php endif; ?>><?php echo $strSize; ?></option>
		<?php endforeach; ?>
	</select>
	<?php endif; ?>
  <p class="tl_help tl_tip">Please select product's size.</p>
</div>
</fieldset>

<fieldset class="tl_box block" id="pal_attribute_info">
<legend onclick="AjaxRequest.toggleFieldset(this, 'attribute_info', 'tl_catalog_attribute')">Product attribute information(stock)</legend>
<div class="w50">
  <h3><label for="ctrl_catalog_stock">Procuct stock</label></h3>
  <input type="text" onfocus="Backend.getScrollOffset();" maxlength="4" value="<?php echo ($this->current['catalog_stock']) ? $this->current['catalog_stock'] : 0; ?>" class="tl_text" id="ctrl_catalog_stock" name="catalog_stock">
  <p class="tl_help tl_tip">Please select product's stock.</p>
</div>
</fieldset>
</div>

<div class="tl_formbody_submit">

<div class="tl_submit_container">
<input type="submit" value="Save" accesskey="s" alt="save all changes" class="tl_submit" id="save" name="save">
<input type="submit" value="Save and close" accesskey="c" alt="save all changes and return" class="tl_submit" id="saveNclose" name="saveNclose">
<input type="submit" value="Save and new" accesskey="n" alt="save all changes and create new record" class="tl_submit" id="saveNcreate" name="saveNcreate">
</div>

</div>
</form>